package com.cs.pk.actions;

import org.eclipse.swt.SWT;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.events.DragDetectEvent;
import org.eclipse.swt.events.DragDetectListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Shell;

import com.cs.pk.form.BuildConfigurationForm;

public class LaunchConfigurationForm {
    
    public static void launchForm(String id,Shell parent, Image image){
	final BuildConfigurationForm bcf = new BuildConfigurationForm();
	Shell shell = new Shell(parent, SWT.DIALOG_TRIM
		| SWT.PRIMARY_MODAL | SWT.RESIZE);
	shell.setLayout(new GridLayout(1, false));
	shell.setImage(image);
	Rectangle bounds = parent.getMonitor().getBounds();

	shell.setBounds(bounds.width / 8, 0,
		bounds.width * 3 / 5, bounds.height * 8 / 9);
	shell.addDisposeListener(new DisposeListener() {

	    public void widgetDisposed(DisposeEvent e) {
		System.out.println(" Disposing bcf..");
		bcf.dispose();
	    }

	});
	bcf.createContents(shell);
	shell.open();
	bcf.selectDefault();
	shell.addDragDetectListener(new DragDetectListener(){

	    public void dragDetected(DragDetectEvent e) {
               		
	    }
	    
	});
    }

}
